package com.rany.day09.demo01;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class MapTest {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("lin","wei");
        map.put("lu","yujie");
        map.put("gu","yongqiang");
        System.out.println(map);

        String lin = map.get("lin");
        System.out.println(lin);

        boolean lu = map.containsKey("lu");
        System.out.println(lu);

        String gu = map.remove("gu");
        System.out.println(gu);

        Set<String> set = map.keySet();
        System.out.println(set);
        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()){
            String next = iterator.next();
            String s = map.get(next);
            System.out.println(s);
        }
        System.out.println("++++++++++++++");
        for (String s : set) {
            String s1 = map.get(s);
            System.out.println(s1);
        }
    }

}
